using System;
using System.Collections.Generic;
using System.Text;
using FriendsNearby.Services.Entities;

namespace FriendsNearby.Services.Tests
{
    class Utils
    {
        public static Dictionary<K,V> Map<K,V>(params object[] args)
        {
            Dictionary<K, V> result = new Dictionary<K, V>();
            for (int i = 0; i < args.Length; i += 2)
            {
                result.Add((K) args[i], (V) args[i+1]);
            }
            return result;
        }

        public static List<T> List<T>(params T[] args)
        {
            return new List<T>(args);
        }

        public static PersonNearby GetPersonNearby(IEnumerable<PersonNearby> source, Guid userID)
        {
            foreach (PersonNearby p in source)
            {
                if (p.UserID == userID)
                    return p;
            }
            return null;
        }
    }
}
